package com.example.li.service;

import com.example.li.mapper.AdminMapper;
import com.example.li.model.Admin;
import com.example.li.util.ResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminService {
    @Autowired
    AdminMapper adminMapper;

    public ResultDTO login(Admin admin) {
        Admin admin1 = adminMapper.selectByLawAdminNumber(admin);

        if (admin1 != null) {
            if (admin1.getLawAdminPwd().equals(admin.getLawAdminPwd())) {
                return new ResultDTO().success(admin1);
            } else {
                return new ResultDTO().failure("密码错误！");
            }
        } else {
            return new ResultDTO().failure("用户不存在！");
        }

    }

}

